package practice.file;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;

public class Copy {
    public static void main(String[] args) throws IOException {
        FileInputStream inputStream = null;
        FileOutputStream outputStream = null;
        try {
            inputStream = new FileInputStream("壁纸2.png");
            outputStream = new FileOutputStream("壁纸2_cp.png");
            long start = System.currentTimeMillis();
            byte[] bytes = new byte[1024 * 1024];
            int readCount = 0;
            while ((readCount = inputStream.read(bytes)) != -1) {
                outputStream.write(bytes, 0, readCount);
            }
            outputStream.flush();
            long end = System.currentTimeMillis();
            System.out.println(end-start);
        } catch (Exception i) {

        } finally {
            inputStream.close();
            outputStream.close();
        }

    }
}
